package com.lb.shopguide.adapter;

import android.graphics.Paint;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.blankj.utilcode.util.LogUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lb.shopguide.R;
import com.lb.shopguide.entity.PointConfigBean;
import com.lb.shopguide.util.pic.ImageLoaderUtils;
import com.netease.nim.uikit.common.util.log.LogUtil;
import com.yqritc.recyclerviewflexibledivider.FlexibleDividerDecoration;
import com.yqritc.recyclerviewflexibledivider.HorizontalDividerItemDecoration;

import java.util.List;

/**
 * Created by kang on 2018/1/3.
 */

public class AdapterPointConfig extends BaseQuickAdapter<PointConfigBean, BaseViewHolder> {
    public AdapterPointConfig(int layoutResId, @Nullable List<PointConfigBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, final PointConfigBean item) {
        View view = helper.itemView;
        ImageView ivShopLogo = view.findViewById(R.id.iv_shop_logo);
        TextView tvShopName = view.findViewById(R.id.tv_shop_name);
        TextView tvConfig = view.findViewById(R.id.tv_point_config);
        TextView tvSettings = view.findViewById(R.id.tv_settings);

        tvShopName.setText(item.getStoreName());
        tvConfig.setText(item.getMoney() + "元" + "=1积分");
        ImageLoaderUtils.getGlideManager().asBitmap().load(item.getStoreLogoUrl()).apply(ImageLoaderUtils.getSGCommonGlideOption(12)).into(ivShopLogo);
        tvSettings.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                mOnSettingClickListener.onSettingClick(item);
            }
        });
    }

    public interface OnSettingClickListener {
        void onSettingClick(PointConfigBean bean);
    }

    private OnSettingClickListener mOnSettingClickListener;

    public void setOnSettingClickListener(OnSettingClickListener listener) {
        mOnSettingClickListener = listener;
    }

}
